import 'dart:convert';

import 'package:hive_flutter/hive_flutter.dart';
import 'package:word_app/app/modules/model/user_model.dart';

class StorageModel {
  //用户数据
  static const String userData = "userData";

  static setUserModelData(String key, dynamic value) async {
    Hive.box(userData).put(key, value);
  }

  static Future deleteUserModel() async {
    await Hive.box(userData).clear();
  }

  static dynamic getUserModelData(String storeKey) {
    try {
      dynamic? tempData = Hive.box(userData).get(storeKey);
      return tempData;
    } catch (e) {
      return null;
    }
  }
}
